package com.ichir.projects.uiframework.xml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlRootElement;

import com.ichir.projects.uiflow.definition.IFlowPart;
import com.ichir.projects.uiflow.definition.ITransition;

/**
 * Flow transitions.
 * 
 * @author mahieddine_ichir
 * @since 1.0.0
 */
@XmlRootElement(name="transition")
@XmlAccessorType(XmlAccessType.FIELD)
public class XmlTransition implements ITransition {

	@XmlAttribute(required=true)
	private String on;

	@XmlAttribute(required=true)
	@XmlIDREF
	private XmlFlowPart to;
	
	@XmlAttribute(required=false)
	private boolean disposeView;

	@Override
	public String getId() {
		return on;
	}

	/**
	 * @param on the on to set
	 */
	public void setOn(String on) {
		this.on = on;
	}

	@Override
	public IFlowPart getTo() {
		return to;
	}

	public void setTo(XmlFlowPart to) {
		this.to = to;
	}

	@Override
	public boolean disposeView() {
		return disposeView;
	}

	public boolean isDisposeView() {
		return disposeView;
	}

	public void setDisposeView(boolean disposeView) {
		this.disposeView = disposeView;
	}
	
}
